<script setup lang="ts">
import { Right, Back } from "@element-plus/icons-vue";
const props = defineProps(["direction"]);
</script>

<template>
  <button class="direction-button">
    <span class="direction-button-text">{{ props.direction }}</span>
    <span
      :class="
        props.direction === '上一個'
          ? 'direction-button-icon'
          : 'direction-button-icon1'
      "
    >
      <Back v-if="props.direction === '上一個'" />
      <Right v-else />
    </span>
  </button>
</template>
<style>
.direction-button {
  position: relative;
  font-size: 14px;
  letter-spacing: 3px;
  height: 35px;
  padding: 0 25px;
  border: none;
  background-color: rgba(93, 85, 213, 0.8);
  color: #fff;
  font-weight: bold;
  text-transform: uppercase;
  overflow: hidden;
  border-radius: 20px;
}
.direction-button::before {
  content: "";
  display: block;
  position: absolute;
  z-index: 0;
  bottom: 0;
  left: 0;
  height: 0px;
  width: 100%;
  background: rgb(78, 34, 236);
  background: linear-gradient(
    90deg,
    rgb(98, 100, 207) 20%,
    rgb(52, 58, 232) 100%
  );
  transition: 0.2s;
}
.direction-button-text {
  position: relative;
}
.direction-button-icon,
.direction-button-icon1 {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  width: 20px;
  position: absolute;
  top: 2em;
  opacity: 0;
  transition: 0.4s;
  color: rgb(240, 9, 9);
  font-weight: bold;
}
.direction-button-icon {
  left: 0;
}
.direction-button-icon1 {
  right: 0;
}
.direction-button:hover::before {
  height: 100%;
}
.direction-button:hover .direction-button-icon {
  top: 7px;
  opacity: 1;
}
.direction-button:hover .direction-button-icon1 {
  top: 7px;
  opacity: 1;
}
</style>
